<%@ page language="java" contentType="text/html" pageEncoding="utf-8"%>
<%@include file="/WEB-INF/pages/common/common.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <%@include file="/WEB-INF/pages/common/head.jsp"%>
    <title><spring:message code="title.supplier"/></title>
    <script type="text/javascript">
        var message =parent.message;
        $(function(){
            $('#supplierId').combogrid({
                panelWidth:300,
                idField:'id',
                textField:'code',
                fitColumns:true,
                nowrap:true,
                editable:false,
                pagination:{showPageList:false,showRefresh:false},
                url:'${path}/basedata/supplier/ajaxList.do',
                frozenColumns:[[
                    {field:'id',title:'ID',checkbox:true}
                ]],
                columns:[[
                    {field:'code',title:'<spring:message code='combogrid.title.supplier.code'/>',width:140},
                    {field:'name',title:'<spring:message code='combogrid.title.supplier.name'/>',width:160},
                    {field:'linkman',title:'<spring:message code='combogrid.title.linkman'/>',width:140}
                ]],
                onSelect:function(rowIndex, rowData){
                    $("#supplierName").val(rowData['name']);
                }
            });
        });
        function save_(){
            var isV =$("#tableForm").form("validate");
            if(!isV) return;
            imonJYRH.showZone();
            $.ajax({
                url : '${path}/basedata/part/ajaxModify.do',
                data : $("#tableForm *").serialize(),
                success : function(reMsg) {
                    if(reMsg.success){
                        parent.returnResult();
                        message.show({ msg : reMsg.msg,title : '<spring:message code='msg.tip'/>',showType:'slide'});
                    }else{
                        if(!imonJYRH.isBlank(reMsg.obj)){
                            $.messager.alert('<spring:message code='msg.tip'/>',reMsg['obj']);
                        }else{
                            $.messager.alert('<spring:message code='msg.tip'/>',reMsg['msg']);
                        }
                    }
                    imonJYRH.hideZone();
                }
            });
        }
    </script>
</head>
<body>
<table class="tableForm" id="tableForm" width="100%">
    <tr>
        <td align="right"><span style="color:red;">*</span><spring:message code='label.part.code'/>:</td>
        <td align="left">
            <input type="hidden" name="id" value="${part.id}"/>
            <input type="text" name="code" value="${part.code}"
                   class="easyui-validatebox" data-options="required:true">
        </td>
    </tr>
    <tr>
        <td align="right"><span style="color:red;">*</span><spring:message code='label.part.name'/>:</td>
        <td align="left">
            <input type="text" name="name" value="${part.name}"
                   class="easyui-validatebox" data-options="required:true"/>
        </td>
    </tr>
    <tr>
        <td align="right"><span style="color:red;">*</span><spring:message code='label.part.part.type'/>:</td>
        <td align="left">
            <select name="partType" class="easyui-combobox" style="width:150px;"
                    data-options="required:true,panelHeight:'auto',editable:false">
                <option value=""><spring:message code='label.choose'/></option>
                <c:forEach var="dict" items="${dictPartTypeList}">
                    <c:choose>
                        <c:when test='${part.partType==dict.code}'>
                            <option value="${dict.code}" selected="true">${dict.name}</option>
                        </c:when>
                        <c:otherwise>
                            <option value="${dict.code}">${dict.name}</option>
                        </c:otherwise>
                    </c:choose>
                </c:forEach>
            </select>
        </td>
    </tr>
    <tr>
        <td align="right"><span style="color:red;">*</span><spring:message code='label.part.product.type'/>:</td>
        <td align="left">
            <select name="productType" class="easyui-combobox" style="width:150px;"
                    data-options="required:true,panelHeight:'auto',editable:false">
                <option value=""><spring:message code='label.choose'/></option>
                <c:forEach var="dict" items="${dictProductTypeList}">
                    <c:choose>
                        <c:when test='${part.productType==dict.code}'>
                            <option value="${dict.code}" selected="true">${dict.name}</option>
                        </c:when>
                        <c:otherwise>
                            <option value="${dict.code}">${dict.name}</option>
                        </c:otherwise>
                    </c:choose>
                </c:forEach>
            </select>
        </td>
    </tr>
    <tr>
        <td align="right"><spring:message code='label.part.drawing.code'/>:</td>
        <td align="left">
            <input type="text" name="drawingCode" value="${part.drawingCode}"/>
        </td>
    </tr>
    <tr>
        <td align="right"><spring:message code='label.part.drawing.version.code'/>:</td>
        <td align="left">
            <input type="text" name="drawingVersionCode" value="${part.drawingVersionCode}"/>
        </td>
    </tr>
    <tr>
        <td align="right"><spring:message code='label.part.supplier.code'/>:</td>
        <td align="left">
            <input id="supplierId" style="width: 145px" type="text" name="supplierId" value="${part.supplierId}"/>
        </td>
    </tr>
    <tr>
        <td align="right"><spring:message code='label.part.supplier.name'/>:</td>
        <td align="left">
            <input type="text" id="supplierName" disabled="true" value="${part.supplierName}"/>
        </td>
    </tr>
    <tr>
        <td align="right"><spring:message code='label.part.customer.name'/>:</td>
        <td align="left">
            <input type="text" name="customerName" value="${part.customerName}"/>
        </td>
    </tr>
    <tr>
        <td align="right"><spring:message code='label.part.customer.project.code'/>:</td>
        <td align="left">
            <input type="text" name="customerProjectCode" value="${part.customerProjectCode}"/>
        </td>
    </tr>
    <tr>
        <td align="right"><spring:message code='label.part.car.model'/>:</td>
        <td align="left">
            <input type="text" name="carModel" value="${part.carModel}"/>
        </td>
    </tr>
    <tr>
        <td align="right"><spring:message code='label.part.comment'/>:</td>
        <td align="left">
            <input type="text" name="comment" value="${part.comment}"/>
        </td>
    </tr>
</table>
<br/>
<div align="right">
    <a class="easyui-linkbutton" href="javascript:void(0);" iconCls="icon-save" onclick="save_();"><spring:message code='button.save'/></a>
    <a class="easyui-linkbutton" href="javascript:void(0);" iconCls="icon-no" onclick="parent.operateDialog.dialog('close');"><spring:message code='button.close'/></a>
</div>
</body>
</html>